package com.print.ane;

import java.io.File;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;


public class MainActivity extends Activity {
	
	//com.dynamixsoftware.printershare
	public static final String PACKET = "com.dynamixsoftware.printershare";
	
	/** PDF **/
	public static final String PRINT_PDF = "com.dynamixsoftware.printershare.ActivityPrintPDF";
	
	/** txt/doc/docx/xls/xlsx/ppt/pptx/hwp **/
	public static final String PRINT_DOC = "com.dynamixsoftware.printershare.ActivityPrintDocuments";
	
	/** gif/png/jpeg/jpg   */
	public static final String PRINT_PIC = "com.dynamixsoftware.printershare.ActivityPrintPictures";
	
	
	public static class PDF{
		public static final String DEF = "application/pdf";
	}
	
	public static class DOC{
		public static final String TXT = "text/plain";
		public static final String MSWORD = "application/msword";
		public static final String DOC = "application/doc";
		public static final String WORD = "application/word";
	}
	
	public static class IMG{
		public static final String GIF = "image/gif";
		public static final String PNG = "image/png";
		public static final String JPEG = "image/jpeg";
	}
	
	
	public static final String PDF_FILE = "/storage/emulated/0/UCDownloads/1.jpg";
	
	
	
	
	

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        //
        Button open = (Button) findViewById(R.id.openactivity);
        open.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				
				ComponentName comp = new ComponentName(PACKET, PRINT_PIC);
				
				Intent intent = new Intent();
				intent.setComponent(comp);
				intent.setAction("android.intent.action.VIEW");
				intent.setType(IMG.JPEG);
				intent.setData(Uri.fromFile(new File(PDF_FILE)));
				startActivity(intent);
			}
		});
        
        
        //���
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}
